package com.yztc.ui.category;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.yztc.helper.BaseAdapterHelper;
import com.yztc.okbuy.R;

import java.util.List;

/**
 * Created by My on 2016/12/19.
 */

public class ListBaseAdapter extends BaseAdapterHelper<CartgroyBean.ResultsBean> {
    public ListBaseAdapter(Context context, List<CartgroyBean.ResultsBean> list) {
        super(context, list);
    }

    @Override
    public View getItemView(int position, View convertView, ViewGroup parent) {
        ViewHolder holder = null;
        if (convertView == null) {
            convertView = mInflater.inflate(R.layout.item_listview_titlefragment, null);
            holder = new ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.textView.setText(mList.get(position).getVirtual_name());
        return convertView;
    }
    class ViewHolder {
        private TextView textView;
        public ViewHolder(View view){
            textView= (TextView) view.findViewById(R.id.textView_item_title);
        }
    }

//    public CartgroyBean parseJsonToBean(String jsonString) {
//        Gson gson = new Gson();
//        return gson.fromJson(jsonString, new TypeToken<CartgroyBean>() {
//        }.getType());
//    }
}
